package cn.kgc.springcloud.controller;

import cn.kgc.springcloud.form.StudentForm;
import cn.kgc.springcloud.service.StudentService;
import cn.kgc.springcloud.vo.StudentVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: 课工场
 * @since 2023/9/13
 */
@RestController
@RequestMapping("student")
public class StudentController {

    @Autowired
    private StudentService studentService;

    //查询学生信息列表
    @GetMapping("list")
    public List<StudentVO> studentVOList() {
       return studentService.getStudentList();
    }


    //添加学生信息
    @PostMapping("add")
    public StudentVO addStudent(@RequestBody StudentForm studentForm) {

        System.out.println("studentForm = " + studentForm);

        return studentService.addStudent(studentForm);
    }


}
